// 1. 导入所需模块
import Vue from 'vue'
import VueRouter from 'vue-router'

import MyHamburger from '@/components/MyHamburger.vue'
import MyHome from '@/components/MyHome.vue'
import MyAbout from '@/components/MyAbout.vue'

import OneChips from '@/components/OneChips'
import TwoCookies from '@/components/TwoCookies'

// 2. 调用 Vue.use() 函数，将 VueRouter 安装为 Vue 的插件
Vue.use(VueRouter)

// 3. 创建路由的实例对象
// const router = new VueRouter(/*一会要写路由的配置*/)
const router = new VueRouter({
    routes: [
        { name: 'home', path: '/home', component: MyHome},
        { name: 'hamburger',path: '/hamburger', component: MyHamburger,children: [
            { name: 'chips',path: 'chips', component: OneChips },
            { name: 'cookies',path: 'cookies', component: TwoCookies },
        ]},
        { name: 'about',path: '/about/:id/:name', component: MyAbout},
        { name: 'sport',path: '/sport', component: () => import('@/components/MySports') }
    ]
})

// 4. 导出路由的实例对象
export default router